package com.fzg.controller;

import com.fzg.common.enums.ResponseWrapper;
import com.fzg.service.impl.WangYiYunService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * create by fzg
 * 2022/8/16 9:46
 */

@RestController
@RequestMapping("/wangyiyun")
public class ConnectWangYiYunServerController {

    @Autowired
    private WangYiYunService wangYiYunService;

    // 获取网抑云音乐每日推荐歌单
    @GetMapping("/getWangYiYunRecommendSongList")
    public ResponseWrapper getWangYiYunRecommendSongList(){
        return wangYiYunService.getWangYiYunRecommendSongList();
    }

    /**
     * 根据歌单获取歌单详情
     * @param id 歌单id
     * @return ResponseWrapper
     */
    @GetMapping("/getGeDanDetailByGeDanId")
    public ResponseWrapper getGeDanDetailByGeDanId(@RequestParam String id){
        return wangYiYunService.getGeDanDetailByGeDanId(id);
    }

    /**
     * 根据歌单id获取歌单歌曲列表
     * @param id 歌单id
     * @return ResponseWrapper
     */
    @GetMapping("/getGeDanSongs")
    public ResponseWrapper getGeDanSongs(@RequestParam String id){
        return wangYiYunService.getGeDanSongs(id);
    }

    /**
     * 通过手机号获取验证码
     * @param phone 手机号
     * @return ResponseWrapper
     */
    @GetMapping("/getVerificationCodeByPhone")
    public ResponseWrapper getVerificationCodeByPhone(@RequestParam String phone){
        return wangYiYunService.getVerificationCodeByPhone(phone);
    }

    /**
     * 根据歌曲id获取歌曲详情
     * @param id 歌曲id
     * @return ResponseWrapper
     */
    @GetMapping("/getSongDetailById")
    public ResponseWrapper getSongDetailById(@RequestParam String id){
        return wangYiYunService.getSongDetailById(id);
    }

    /**
     * 获取轮播图数据
     * @return ResponseWrapper
     */
    @GetMapping("/getBanner")
    public ResponseWrapper getBanner(){
        return wangYiYunService.getBanner();
    }


    /**
     * 验证验证码
     * @param phone 手机号
     * @param captcha 验证码
     * @return ResponseWrapper
     */
    @GetMapping("/verifyShortMessageCode")
    public ResponseWrapper verifyShortMessageCode(@RequestParam String phone, @RequestParam String captcha){
        return wangYiYunService.verifyShortMessageCode(phone,captcha);
    }

    /**
     * 根据歌曲id获取歌词
     * @param id 歌曲id
     * @return ResponseWrapper
     */
    @GetMapping("/getSongLyricBySongId")
    public ResponseWrapper getSongLyric(@RequestParam String id){
        return wangYiYunService.getSongLyric(id);
    }


    /**
     * 获取30位热门歌手
     * @param type
     * -1:全部
     * 1:男歌手
     * 2:女歌手
     * 3:乐队
     *
     *
     * @param area
     * -1:全部
     * 7华语
     * 96欧美
     * 8:日本
     * 16韩国
     * 0:其他
     *
     *
     * @return ResponseWrapper
     */
    @GetMapping("/getThirtyHotSinger")
    public ResponseWrapper getThirtyHotSinger(@RequestParam String type, @RequestParam String area){
        return wangYiYunService.getThirtyHotSinger(type,area);
    }


    /**
     * 获取歌手50首热门歌曲
     * @param id
     * 歌手id
     * @return ResponseWrapper
     */
    @GetMapping("/getSingerFiftyHotSongs")
    public ResponseWrapper getSingerFiftyHotSongs(@RequestParam String id){
        return wangYiYunService.getSingerFiftyHotSongs(id);
    }


    /**
     * 检查歌曲是否可用（可播放）
     * @param id
     * 歌曲id
     * @return ResponseWrapper
     */
    @GetMapping("/checkSongAvailable")
    public ResponseWrapper checkSongAvailable(@RequestParam String id){
        System.out.println("范占国：  " + id);
        return wangYiYunService.checkSongAvailable(id);
    }




}
